import { EUIEvent } from "src/Game/MesEvent/EUIEvent";
import CameraControl from "src/Ldz_GameCore/PlayerCore/CameraControl";
import ResourcePropsManager from "src/Ldz_GameCore/ResourceProps/ResourcePropsManager";
import SceneNode from "src/_T/D3/scene/SceneNode";
import MesManager from "src/_T/Mes/MesManager";
import ResLoad from "src/_T/Res/ResLoad";
import { LevelManager } from "./LevelManager";

export default class Game3DSceneManager extends Laya.Script3D {

    Init() {

    }
    /**加载场景 */
    LodeStarScene() {
        //显示UI
        LevelManager.LoadLevel(0, Laya.Handler.create(this, this.MainSceneLodeRe));
    }
    LodeBack(Url: string) {
        ResLoad.GetRes(Url);
    }
    /**主场景加载完毕返回方法 */
    MainSceneLodeRe(level: SceneNode) {
        //设置并获取房间节点
        /**初始化资源管理器 */
        ResourcePropsManager.Instance.Init();
        //摄像机控制器初始化
        CameraControl.Instance.Init();
        /**地图雷达 */
        //MapCameraCon.Instance.InitMapCamera(level);
        /**开启加载是否完毕检测 */
        Laya.timer.frameLoop(1, this, this.CheckWhetherLoadingIsCompleted, [level]);
    }
    /**检测主场景是否加载完毕 */
    CheckWhetherLoadingIsCompleted(level: SceneNode) {
        MesManager.event(EUIEvent.ShowUIMain);
    }
    private AddComponent(list: Laya.Node[], script) {
        if (list && (list.length > 0)) {
            list.forEach(obj => obj.addComponent(script));
        }
    }
    onUpdate() {

    }

}